package com.atguigu07._abstract.ex2;

public class SalariedEmployee extends Employee{
    private int monthlySalary;

    public int getMonthlySalary() {
        return monthlySalary;
    }

    public void setMonthlySalary(int monthlySalary) {
        this.monthlySalary = monthlySalary;
    }

    public SalariedEmployee(String name, int number, MyDate date, int monthlySalary) {
        super(name, number, date);
        this.monthlySalary = monthlySalary;
    }

    public  int earning(int mon){
        int a=this.getMonthlySalary();
        if (mon==this.getDate().getMonth()){
            a+=100;
        }
        return a;
    }

    @Override
    public String toString() {
        return "name:"+getName()+" number:"+getNumber()+" birthday:"+getDate().printBirth()+" SalariedEmployee{" +
                "monthlySalary=" + monthlySalary +
                '}';
    }
}
